package cn.glutnn.service;

import cn.glutnn.entity.Result;
import cn.glutnn.entity.dto.MessageDTO;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.glutnn.entity.Messages;

import java.io.IOException;
import java.util.List;


/**
 * (Messages)表服务接口
 *
 * @author msh
 * @since 2024-12-27 13:06:42
 */
public interface MessagesService extends IService<Messages> {

    void sendMessage(Messages messages) throws IOException;

    // 接收所有消息
    Result<List<MessageDTO>> getMessages(int userId);

    // 接收所有未读消息
    Result<List<Messages>> receiveUnreadMessages(int receiverId);

    // 根据发送者ID和接收者ID获取所有消息
    Result<List<Messages>> getMessagesBySenderIdAndReceiverId(int senderId, int receiverId);

    // 将消息标记为已读
    void markAsRead(int senderId);
}

